<?php
error_reporting(0);
include 'db-connection/conn.php';
include 'submitemail.php';

$fname =  $_REQUEST["realname"];
$lname =  $_REQUEST["lastname"];
$address = $_REQUEST["address"];
$city = $_REQUEST["city"];
$province = $_REQUEST["Province"];
$postalcode=$_REQUEST["PostalCode"];
$phone=$_REQUEST["Phone"];
$email=$_REQUEST["email"];
$date_requested=$_REQUEST["ServiceDate"];
$services_requested=$_REQUEST["ServicesRequested"];

$mailTo = "dasprasenjit55@gmail.com";

/*SUBJECT & BODY OF THE EMAIL*/
$subject = ucfirst($fname)." has requested for servicing";


$comment = "";
$comment .=" First Name: ".ucfirst($fname);
$comment .="\n";
$comment .="Last Name: ".ucfirst($lname);
$comment .="\n";
$comment .="Email Address: ".ucfirst($email);
$comment .="\n";
$comment .="Contact No : ".ucfirst($Phone);
$comment .="\n";
$comment .="address : ".ucfirst($address);
$comment .="\n";
$comment .="city : ".ucfirst($city);
$comment .="\n";
$comment .="province : ".ucfirst($province);
$comment .="\n";
$comment .="date_requested : ".ucfirst($date_requested);
$comment .="\n";
$comment .="services_requested : ".ucfirst($services_requested);
$comment .="\n";
/*  ENDS */

$sqlDonate="insert into tbl_service_request(fname,lname,address,city,province,postalcode,phone,email,date_requested,services_requested,is_answered) values('$fname','$lname','$address','$city ','$province ','$postalcode','$phone','$email','$date_requested','$services_requested','y')";
$run = mysql_query($sqlDonate);

if($run)
{
	GENERATE_SMTP_MAIL($mailTo,$email,$name,'','',$subject,$comment);
	header("Location:service-request-form.php?msg=success");
}
else
{
	header("Location:service-request-form.php?msg=failure");
}
?>